﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Manager/Manager.master" AutoEventWireup="true"
    CodeFile="AddQuestion.aspx.cs" Inherits="Manager_AddQuestion" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PageTitle" runat="Server">
    Add New Question | Aptitude Online Test
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PageHeader" runat="Server">
    <script type="text/javascript">
        $(document).ready(function () {
            
        })
        function checkSelectAnswer(obj, args) {
            if (document.aspnetForm.ctl00_BodyContent_rdo1.checked == false &&
            document.aspnetForm.ctl00_BodyContent_rdo2.checked == false &&
            document.aspnetForm.ctl00_BodyContent_rdo3.checked == false &&
            document.aspnetForm.ctl00_BodyContent_rdo4.checked == false) {
                args.IsValid = false;
            }
            else {
                args.IsValid = true;
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="BodyContent" runat="Server">
    <div class="header">
        <span><span class="ico  gray spreadsheet"></span>Add new Question</span>
    </div>
    <!-- End header -->
    <div class=" clear">
    </div>
    <div class="content">        
        <p>
            <asp:Label ID="lblCategory" runat="server" Text="Category" Width="150px"></asp:Label>
            <asp:DropDownList ID="ddlCategory" runat="server">
            </asp:DropDownList>
        </p>
        <p>
            <asp:Label ID="lblQuestion" runat="server" Text="Question" Width="150px"></asp:Label>
        </p>
        <p>
            <asp:TextBox ID="txtQuestion" runat="server" MaxLength="500" Rows="1" TextMode="MultiLine"
                Width="800px"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtQuestion"
                Display="Dynamic" ErrorMessage="Question content is not empty"></asp:RequiredFieldValidator>
        </p>
        <p>
            <asp:Label ID="lblType" runat="server" Text="Multiple or Single answer?" Width="180px"></asp:Label>
            <asp:RadioButton ID="rdoSingle" runat="server" GroupName="type" Text="Single" Width="120px"
                Checked="True" />
            <asp:RadioButton ID="rdoMultiple" runat="server" GroupName="type" 
                Text="Multiple" Visible="False" />
        </p>
        <p>
            <table>
                <tr>
                    <td class="title">
                        is True?
                    </td>
                    <td class="title">
                        Content<asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="checkSelectAnswer"
                            ErrorMessage="Choose at once least answer true"></asp:CustomValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:RadioButton ID="rdo1" runat="server" GroupName="checktrue" />
                    </td>
                    <td>
                        <asp:TextBox ID="txtAnswer1" runat="server" Width="400px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtAnswer1"
                            ErrorMessage="This field is not empty"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:RadioButton ID="rdo2" runat="server" GroupName="checktrue" />
                    </td>
                    <td>
                        <asp:TextBox ID="txtAnswer2" runat="server" Width="400px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtAnswer2"
                            ErrorMessage="This field is not empty"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:RadioButton ID="rdo3" runat="server" GroupName="checktrue" />
                    </td>
                    <td>
                        <asp:TextBox ID="txtAnswer3" runat="server" Width="400px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtAnswer3"
                            ErrorMessage="This field is not empty"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:RadioButton ID="rdo4" runat="server" GroupName="checktrue" />
                    </td>
                    <td>
                        <asp:TextBox ID="txtAnswer4" runat="server" Width="400px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtAnswer4"
                            ErrorMessage="This field is not empty"></asp:RequiredFieldValidator>
                    </td>
                </tr>
            </table>
        </p>
       
        <p>
            <asp:Label ID="lblMark" runat="server" Text="Mark" Width="60px"></asp:Label>
            <asp:TextBox ID="txtMark" runat="server" Width="50px" MaxLength="3">1</asp:TextBox>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                ControlToValidate="txtMark" ErrorMessage="Mark must be number" 
                ValidationExpression="^\d+$"></asp:RegularExpressionValidator>
        </p>
        <div style="padding: 2px 0px;">
            <asp:Button ID="btnAdd" class="uibutton normal" runat="server" Text="Add Question"
                OnClick="btnAdd_Click" />
            <asp:Button ID="btnReset" class="uibutton normal" runat="server" OnClientClick="this.form.reset();return false;"
                Text="Reset" />
        </div>
        <div class=" clear">
        </div>
    </div>
</asp:Content>
